// VoterSurveyPubOp
log using VoterSurveyPubOp.log, replace

use "C:\Users\sbstjp\OneDrive - Cardiff University\voter_panel.dta"  // Democracy Fund Voter Study Group. VIEWS OF THE ELECTORATE RESEARCH SURVEY. Washington, D.C. https://www.voterstudygroup.org/.  Date accessed: March 09, 2025.

*Delete skipped responses   
replace defundpolice_2020Sep=. if defundpolice_2020Sep==8 
replace police_threat_2020Sep=. if police_threat_2020Sep==8
replace usa_founders_2020Sep=. if usa_founders_2020Sep==8 

// Demographic variables
gen age = 2020 - birthyr_2020Sep 
rename gender_2020Sep FemaleGender 
replace ideo5_2020Sep=. if ideo5_2020Sep==6 

*Generate dummy variables
gen Graduate=.
replace Graduate=1 if inlist(educ_2020Sep, 5, 6) 
replace Graduate=0 if inrange(educ_2020Sep, 1, 4)

gen BIPOC=.
replace BIPOC=0 if race_2020Sep==1
replace BIPOC = 1 if inrange(race_2020Sep, 2, 8) 

* Answers to the questions
tab defundpolice_2020Sep [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if ideo5_2020Sep<3 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if ideo5_2020Sep>3 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if Graduate==0 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if Graduate==1 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if BIPOC==0 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if BIPOC==1 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if FemaleGender==1 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if FemaleGender==2 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if age<35 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if age>=35 & age<=59 [aweight=weight_genpop_2020Sep]
tab defundpolice_2020Sep if age>59 [aweight=weight_genpop_2020Sep]

tab police_threat_2020Sep [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if ideo5_2020Sep<3 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if ideo5_2020Sep>3 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if Graduate==0 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if Graduate==1 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if BIPOC==0 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if BIPOC==1 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if FemaleGender==1 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if FemaleGender==2 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if age<35 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if age>=35 & age<=59 [aweight=weight_genpop_2020Sep]
tab police_threat_2020Sep if age>59 [aweight=weight_genpop_2020Sep]

tab usa_founders_2020Sep [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if ideo5_2020Sep<3 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if ideo5_2020Sep>3 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if Graduate==0 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if Graduate==1 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if BIPOC==0 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if BIPOC==1 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if FemaleGender==1 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if FemaleGender==2 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if age<35 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if age>=35 & age<=59 [aweight=weight_genpop_2020Sep]
tab usa_founders_2020Sep if age>59 [aweight=weight_genpop_2020Sep]

log close
